<?php
include('config.php');
include('include/function.php');

// debug
include('ChromePhp.php');

/* Connect to the database */
$g_conn = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die('Could not connect to the database');
$g_db = mysql_select_db(DB_NAME) or die('Could not select database');
mysql_query("SET NAMES utf8");

/* Start session */
session_start();

/* Output to buffer */
ob_start();

/* Load config */
$g_config = array();
load_config();

/* Process AJAX */
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) 
	AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {

	include('site/ajax.php');
} 
/* Load page */
else {
	include('site/site.php');
}
?>